import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame([['green', 'a'],
                   ['green', 'b'],
                   ['blue', 'a'],
                   ['blue', 'b'],
                   ['blue', 'c'],
                   ['green', 'a'],
                   ['green', 'a']],
                  columns=['Jia', 'Yi'])
# 交叉表
ct = pd.crosstab(df['Jia'], df['Yi'])
print(ct)
